import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;


public class Samples{

	private ArrayList<Points> pointsList;
	private double fx;
	private Map<Double, Integer> frequency;
	
	public Samples(){
		pointsList = new ArrayList<>();
	}
	
	public void addPoint(Points point){
		pointsList.add(point);
	}

	public double getMean(){
		double average = 0;
		for(int i=0; i<pointsList.size(); i++){
			average += pointsList.get(i).getX();
		}
		
		return average / pointsList.size();
	}
	
	public double getVariance(){
		double variance = 0.0;
		double mean = getMean();
		for (int i = 0; i < pointsList.size(); i++) {
			variance += Math.pow(pointsList.get(i).getX() - mean , 2);
		}
		
		return variance / pointsList.size();
	}

	public ArrayList<Points> getPointsList() {
		return pointsList;
	}

	public void setPointsList(ArrayList<Points> pointsList) {
		this.pointsList = pointsList;
	}

	public Map<Double, Integer> getFrequency() {
		return frequency;
	}

	public void setFrequency(Map<Double, Integer> frequency) {
		this.frequency = frequency;
	}

	public double getFx() {
		return fx;
	}

	public void setFx(double fx) {
		this.fx = fx;
	}
	
	
	
}
